package com.huawei.hwid.core.d;

public class e {
    private static int a = -1;
    private static int b;

    static {
        c();
    }

    private static void c() {
        b = e();
        if (b >= 17) {
            a = 90;
        }
        if (b >= 11) {
            a = 50;
        } else if (b >= 10) {
            a = 41;
        } else if (b >= 9) {
            a = 40;
        } else if (b >= 8) {
            a = 31;
        } else if (b >= 7) {
            a = 30;
        }
        if (a == -1) {
            d();
        }
    }

    private static void d() {
        String str = "EmotionUI_3.0";
        str = "EmotionUI_3.1";
        str = "EmotionUI_4.0";
        str = "EmotionUI_4.1";
        str = "EmotionUI_5.0";
        try {
            Class cls = Class.forName("android.os.SystemProperties");
            str = (String) cls.getDeclaredMethod("get", new Class[]{String.class}).invoke(cls, new Object[]{"ro.build.version.emui"});
            if (str == null) {
                return;
            }
            if (str.contains("EmotionUI_3.0")) {
                a = 30;
            } else if (str.contains("EmotionUI_3.1")) {
                a = 31;
            } else if (str.contains("EmotionUI_4.0")) {
                a = 40;
            } else if (str.contains("EmotionUI_4.1")) {
                a = 41;
            } else if (str.contains("EmotionUI_5.0")) {
                a = 50;
            }
        } catch (RuntimeException e) {
            com.huawei.hwid.core.d.b.e.d("EmuiUtil", "RuntimeException getEmuiType.", true);
        } catch (Exception e2) {
            com.huawei.hwid.core.d.b.e.d("EmuiUtil", "getEmuiType Exception.", true);
        }
    }

    public static boolean a() {
        return b >= 17;
    }

    public static boolean b() {
        return b >= 21;
    }

    private static int e() {
        Object a = k.a("com.huawei.android.os.BuildEx$VERSION", "EMUI_SDK_INT");
        if (a != null) {
            try {
                return ((Integer) a).intValue();
            } catch (ClassCastException e) {
                com.huawei.hwid.core.d.b.e.d("EmuiUtil", "getEMUIVersionCode is not a number", true);
            }
        }
        return 0;
    }
}
